//
//  TextField.m
//  gdemm
//
//  Created by 乔明超 on 16/9/22.
//  Copyright © 2016年 Goldencis. All rights reserved.
//

#import "TextField.h"
#import "Masonry.h"
@implementation TextField

- (instancetype)initWithPlaceholder: (NSString *)placeholder leftImage:(NSString *)leftString rightImage:(NSString *)rightString
{
    self = [super init];
    if (self) {
        
        UITextField *textField = [[UITextField alloc]init];
        textField.placeholder = placeholder;
        textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
        textField.autocorrectionType = UITextAutocorrectionTypeNo;
        [textField setValue:HRColor(151, 151, 151) forKeyPath:@"placeholderLabel.textColor"];
        [textField setValue:[UIFont boldSystemFontOfSize:14] forKeyPath:@"placeholderLabel.font"];
        textField.textColor = HRColor(71, 71, 71);
        textField.leftViewMode =  UITextFieldViewModeAlways;
        
        UIImageView *imageUser = [[UIImageView alloc]initWithFrame:CGRectMake(6, 6, 22, 22)];
        imageUser.image = [UIImage imageNamed:leftString];
        textField.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 44, 44)];
        [textField.leftView addSubview:imageUser];
        
    }
    return self;
}

@end
